package output;

import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayList;

public class FileWriter {
	
	ArrayList<float[]> resultList;
	ArrayList<String> additionalInformation;
	
	public FileWriter(ArrayList<String> additionalInformation, ArrayList<float[]> resultList) {
		this.resultList=resultList;
		this.additionalInformation=additionalInformation;
	}

	public void write() {
		PrintWriter fileWriter;
		try {
			fileWriter = new PrintWriter("output.csv");
			for (int i = 0; i < resultList.size(); i++) {
				float[] result = resultList.get(i);
				String finalString="";
				for (int j = 0; j < result.length; j++) {
					if (j==(result.length-1)){
						finalString += result[j];
					}else{
						finalString += result[j] + ";";
				}}
				fileWriter.println(additionalInformation.get(i) + finalString +";");
			}
			fileWriter.close();
						
		} catch (FileNotFoundException e) {
			System.out.println("Kann nicht schreiben!");
		}
		
	}
	
	

}
